//
//  MFYPresentationController.m
//  HandyService
//
//  Created by jjkj on 2017.7.11.
//  Copyright © 2017年 jjkj. All rights reserved.
//
/* ***********************************************************************
 * 项目名称:
 * 项目组:
 * 创建时间:2017.7.11
 * 创建人:马方印
 * 用途:自定义modal动画
 * 版本:1.0
 * 修改记录:    修改内容   修改原因   修改人   修改时间
 *               无        无       无       无
 *************************************************************************/
#import "MFYPresentationController.h"

@interface MFYPresentationController()

@property (nonatomic, strong) UIView *backView;

@end

@implementation MFYPresentationController


- (void)containerViewWillLayoutSubviews {
    
    [self.containerView insertSubview:self.backView atIndex:0];
    self.backView.frame = self.containerView.bounds;
    self.presentedView.frame = _presentedViewFrame;
}

- (void)tapClick:(UIGestureRecognizer *)tap{
    
    [self.presentedViewController dismissViewControllerAnimated:NO completion:nil];
}

- (UIView *)backView{
    
    if (!_backView) {
        
        _backView = [[UIView alloc]init];
        _backView.backgroundColor = [UIColor clearColor];
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapClick:)];
        [_backView addGestureRecognizer:tap];
    }
    
    return _backView;
}

@end
